[dominfo.getName(), dominfo.getDomain(), "fail"])
return dominfo
- def domain_configure(self, vmconfig):
+ def domain_configure(self, config):
"""Configure an existing domain. This is intended for internal
use by domain restore and migrate.
@param vmconfig: vm configuration
"""
- config = sxp.child_value(vmconfig, 'config')
return XendDomainInfo.restore(self.dbmap.getPath(), config)
def domain_restore(self, src, progress=False):
try:
fd = os.open(src, os.O_RDONLY)
- return XendCheckpoint.restore(self, fd)
+ dominfo = XendCheckpoint.restore(self, fd)
+ self._add_domain(dominfo)
+ return dominfo
except OSError, ex:
raise XendError("can't read guest state file %s: %s" %
(src, ex[1]))
"""
if domid == PRIV_DOMAIN:
- raise XendError("Cannot destroy priviliged domain %i" % domid)
+ raise XendError("Cannot destroy privileged domain %i" % domid)
self.domain_restart_schedule(domid, reason, force=True)
dominfo = self.domain_lookup(domid)
@param uuid: uuid to use
"""
- log.debug("XendDomainInfo.restore(%s, ..., %s)", dompath, uuid)
+ log.debug("XendDomainInfo.restore(%s, %s, %s)", dompath, config, uuid)
if not uuid:
uuid = getUuid()
vm = cls(uuid, dompath, cls.parseConfig(config),
xc.domain_create(ssidref = ssidref))
vm.clear_shutdown()
+ vm.create_channel()
+ vm.configure()
+ vm.exportToDB()
return vm
restore = classmethod(restore)
if not self.info['maxmem_KiB']:
self.info['maxmem_KiB'] = 1 << 30
+ if self.info['maxmem_KiB'] > self.info['memory_KiB']:
+ self.info['maxmem_KiB'] = self.info['memory_KiB']
+
# Validate the given backend names.
for s in self.info['backend']:
if s not in backendFlags:
if self.info:
sxpr.append(['maxmem', self.info['maxmem_KiB'] / 1024])
+ if self.infoIsSet('device'):
+ for (n, c) in self.info['device']:
+ sxpr.append(['device', c])
+
def stateChar(name):
if name in self.info:
if self.info[name]:
"""
if not self.rebooting():
self.create_configured_devices()
- self.image.createDeviceModel()
+ if self.image:
+ self.image.createDeviceModel()
def device_create(self, dev_config):
"""Create a new device.
"""
self.configure_maxmem()
self.create_devices()
- self.create_blkif()
-
- def create_blkif(self):
- """Create the block device interface (blkif) for the vm.
- The vm needs a blkif even if it doesn't have any disks
- at creation time, for example when it uses NFS root.
-
- """
- return
def configure_maxmem(self):